<template>
  <div style="height: 100%;width: 100%;position: relative;overflow: hidden;" :style="{'background':!!lineChart3Data.back?lineChart3Data.back:'#fff'}" :id="lineChart3Data.id" class="_wz_char">

  </div>
</template>
<script>
  export default {
    props: ["bottomHeight", "lineChart3Data"],//接收来自父组件的数据
    data() {
      return {}
    },
    beforeCreate() {//beforeCreate创建前状态

    },
    created() {//created创建完毕状态

    },
    beforeMount() {//beforeMount挂载前状态   DOM 元素然后塞入页面的过程

    },
    mounted() {//mounted 挂载结束状态
      let that = this;
      let data = that.lineChart3Data.data;
      let chart = new G2.Chart({
        container: that.lineChart3Data.id,
        forceFit: true,
        height: that.bottomHeight,
        padding: !!that.lineChart3Data.style.padding ? that.lineChart3Data.style.padding : 'auto'
      });
      chart.source(data);
      chart.scale('sales', {
        alias: that.lineChart3Data.unit,

      });
      chart.interval().position('year*sales');
      chart.render();
    },
    methods: {//执行的方法

    },
    watch: {//监听

    },
    beforeUpdate() {//beforeUpdate 更新前状态

    },
    updated() {//updated 更新完成状态

    },
    beforeDestroy() {//beforeDestroy 销毁前状态

    },
    destroyed() {//destroyed 销毁完成状态

    }
  }
</script>
